Skip to content

Handle ROUTING_APP error response in onResponseTraceRoute#930

Merged
ianmcorvidae merged 3 commits into
meshtastic:masterfrom
pieceofr:fix/traceroute-routing-error-response
Jun 12, 2026
Merged

Handle ROUTING_APP error response in onResponseTraceRoute#930
ianmcorvidae merged 3 commits into
meshtastic:masterfrom
pieceofr:fix/traceroute-routing-error-response

Conversation

@NoctisSentinel

Copy link
Copy Markdown
Contributor

Summary

  • onResponseTraceRoute did not handle ROUTING_APP error packets, causing it to attempt parsing them as RouteDiscovery payloads, resulting in a crash or silent failure followed by a spurious timeout message
  • Added a check at the start of onResponseTraceRoute that prints the specific errorReason and exits the wait loop cleanly
  • Unlike onResponseTelemetry and onResponseWaypoint which show a hardcoded firmware version message, traceroute shows the actual error reason since it is a diagnostic tool where knowing the specific failure is more valuable

Test plan

  • Traceroute to unreachable node shows Traceroute failed: MAX_RETRANSMIT (or relevant error) without a spurious Timed out waiting for traceroute message
  • Successful traceroute still displays route correctly

🤖 Generated with Claude Code

Previously, receiving a ROUTING_APP packet in response to a traceroute
would cause the function to attempt parsing it as a RouteDiscovery
payload, resulting in a crash or silent failure followed by a timeout.

This mirrors the error handling already present in onResponseTelemetry
and onResponseWaypoint, but displays the specific errorReason instead
of a hardcoded firmware version message, since traceroute is a
diagnostic tool where the exact failure reason is more valuable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jun 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Meshtastic’s Python interface traceroute response handling to properly deal with ROUTING_APP error responses, avoiding mis-parsing routing errors as RouteDiscovery payloads and preventing misleading timeout behavior.

Changes:

  • Added an early check in onResponseTraceRoute for ROUTING_APP packets to detect traceroute failures.
  • Prints the specific routing.errorReason on traceroute failure and terminates the traceroute wait cleanly by setting receivedTraceRoute.

Comment on lines +690 to +694
if p["decoded"]["portnum"] == "ROUTING_APP":
error = p["decoded"]["routing"]["errorReason"]
print(f"Traceroute failed: {error}")
self._acknowledgment.receivedTraceRoute = True
return

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the unit test, can you check again ?

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@NoctisSentinel

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Added a unit test in the latest commit that feeds a ROUTING_APP response with MAX_RETRANSMIT into onResponseTraceRoute and asserts both that receivedTraceRoute is set to True and the error message is printed.

ROUTING_APP with errorReason NONE is an ACK (success), not an error.
Only print failure message for non-NONE error reasons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ianmcorvidae

Copy link
Copy Markdown
Contributor

@NoctisSentinel I set copilot to re-review. I haven't had time to check on this PR yet but the changes look generally good to me, I just want to check for myself that the ROUTING_APP errors do in fact flow to this function and the handling looks basically reasonable. I can't promise exactly when I'll get to that, but hopefully soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.24%. Comparing base (8f0faf5) to head (953d012).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #930      +/-   ##
==========================================
+ Coverage   63.19%   63.24%   +0.04%     
==========================================
  Files          25       25              
  Lines        4521     4527       +6     
==========================================
+ Hits         2857     2863       +6     
  Misses       1664     1664              
Flag Coverage Δ
unittests 63.24% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ianmcorvidae

Copy link
Copy Markdown
Contributor

Alright, checked on it. I'd forgotten if the ROUTING_APP response handling was limited to errorReason NONE (i.e., acks) or all ROUTING_APP responses, and if traceroutes requested those be passed to the response handler. It appears the answer is that traceroute handling doesn't request those, but it's only for actual acks. So this all seems sensible to me and I'll get this merged. Thanks for the PR!

@ianmcorvidae ianmcorvidae merged commit e4f0fb2 into meshtastic:master Jun 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants